package com.grape.validator;

import com.grape.annotation.ValidDeviceType;
import com.grape.constants.Constants;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 类描述： 验证设备类型校验
 * @author  putao
 * @email   2628279194@qq.com
 */
public class DeviceTypeValidator implements ConstraintValidator<ValidDeviceType, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        return Constants.TYPE_PC.equals(value) || Constants.TYPE_PHONE.equals(value);
    }
}
